package com.weic.easycache.test.example;

/**
<p>配置写法示例:</p>
  
<pre>
public enum TableConf {
	User,
	UserConfig;

	private WeakReference(Table(?, ?>> table;
	private Table(?, ?> getCache() {
		if(table != null) return table.get();
		return null;
	}
	private void cache(Table(?, ?> t) {
		table = new WeakReference(Table(?,?>>(t);
	}

	public Table(?, ?> get() {
		Table(?, ?> table = getCache();
		if(table != null) return table;

		switch (this) {
		case User:
			table = new Table(User, Long>(){};
			break;
		case UserConfig:
			table = new Table(UserConfig, Long>(){};
			break;
		}
		cache(table);
		return table;
	}

	public static Table(?, ?>[] getAll() {
		TableConf[] values = values();
		Table(?, ?>[] tables = new Table(?, ?>[values.length];
		for(int i=0; i(values.length; i++) {
			tables[i] = values[i].get();
		}
		return tables;
	}
}
</pre>
**/
public enum TableConf {
	/*User,
	UserConfig;

	private WeakReference<Table<?, ?>> table;
	private Table<?, ?> getCache() {
		if(table != null) return table.get();
		return null;
	}
	private void cache(Table<?, ?> t) {
		table = new WeakReference<Table<?,?>>(t);
	}

	public Table<?, ?> get() {
		Table<?, ?> table = getCache();
		if(table != null) return table;

		switch (this) {
		case User:
			table = new Table<User, Long>(){};
			break;
		case UserConfig:
			table = new Table<UserConfig, Long>(){};
			break;
		}
		cache(table);
		return table;
	}

	public static Table<?, ?>[] getAll() {
		TableConf[] values = values();
		Table<?, ?>[] tables = new Table<?, ?>[values.length];
		for(int i=0; i<values.length; i++) {
			tables[i] = values[i].get();
		}
		return tables;
	}*/
}